package Common;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class RequestMessage {

	public static final String CREATE = "0";
	public static final String SIGNIN = "1";
	public static final String SIGNOUT = "2";
	public static final String STATUS = "3";
	public static final String TRANSFER = "4";
	public static final String SUSPEND = "5";

	public List<String> argList = null;

	public RequestMessage() {
		argList = new ArrayList<String>();
	}

	public RequestMessage(String msg) {
		argList = Arrays.asList(msg.split(Share.DELIMETER));
	}

	public String getString() {
		StringBuilder ret = new StringBuilder();
		for (String it : argList) {
			ret.append(it);
			ret.append(Share.DELIMETER);
		}
		return ret.toString();
	}
	
	public void generateCreateRequest(String firstName, String lastName, String Age, String userName, String password, String iPAddress){
		argList.add(CREATE);
		argList.add(firstName);
		argList.add(lastName);
		argList.add(Age);
		argList.add(userName);
		argList.add(password);
		argList.add(iPAddress);
	}
	
	public void generateSignIn(String userName, String password,String iPAddress){
		argList.add(SIGNIN);
		argList.add(userName);
		argList.add(password);
		argList.add(iPAddress);
	}
	
	public void generateSignOut(String userName, String iPAddress){
		argList.add(SIGNOUT);
		argList.add(userName);
		argList.add(iPAddress);
	}
	
	public void generteStatus(String adminUsername, String adminPassword,String iPAddress){
		argList.add(STATUS);
		argList.add(adminUsername);
		argList.add(adminPassword);
		argList.add(iPAddress);
	}
	
	public void generateTransfer(String username, String password,String oldIPAddress, String newIPAddress){
		argList.add(TRANSFER);
		argList.add(username);
		argList.add(password);
		argList.add(oldIPAddress);
		argList.add(newIPAddress);
	}
	
	public void suspendAccount(String adminUsername, String adminPassword,String adminIP, String usernameToSuspend){
		argList.add(SUSPEND);
		argList.add(adminUsername);
		argList.add(adminPassword);
		argList.add(adminIP);
		argList.add(usernameToSuspend);
	}
}
